# -*- coding: UTF-8 -*-
from django.db import models
from django.contrib import admin
#from django.core.management.validation import max_length

class Item(models.Model):
    """
  商品
    """
    name = models.CharField(max_length=100)
    photo_url = models.CharField(max_length=255, blank=True)
    descn = models.TextField(blank=True)
    
    #owner = models.ForeignKey(auth_user)
    owner = models.IntegerField()  #外键应该是auth_user表的id，不过不知道要怎么引用
    
    def __str__(self):
        return self.name
    
    class ItemAdmin(admin.ModelAdmin):
        list_display   = ('name', 'descn')
        list_filter    = ('name', )
        ordering       = ('name',)
        search_fields  = ('name','descn')

    
admin.site.register(Item, Item.ItemAdmin)    